package org.dromara.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.dromara.annotation.DataPermission;

/**
 * @ClassName EY-DataPermissionAspect
 * @Description org.dromara.aspect
 * @Author menyj
 * @Date 2025/9/20
 **/
@Slf4j
@Aspect
public class DataPermissionAspect {

    /**
     * 处理请求前执行
     */
    @Before(value = "@annotation(dataPermission)")
    public void doBefore(JoinPoint joinPoint, DataPermission dataPermission) {
        log.info("DataPermissionAspect doBefore");
        System.out.println("sys DataPermissionAspect doBefore");
//        DataPermissionHelper.setPermission(dataPermission);
    }

    /**
     * 处理完请求后执行
     *
     * @param joinPoint 切点
     */
    @AfterReturning(pointcut = "@annotation(dataPermission)")
    public void doAfterReturning(JoinPoint joinPoint, DataPermission dataPermission) {
        log.info("DataPermissionAspect doAfterReturning");
        System.out.println("sys DataPermissionAspect doAfterReturning");
//        DataPermissionHelper.removePermission();
    }
}
